#pragma once

#include <QString>
#include <QJsonObject>
#include <QJsonArray>
#include <QList>

namespace WordMemory
{
    struct Example
    {
        int id;
        QString example;
        QString translation;

        Example(int id = 0, const QString &example = "", const QString &translation = "");

        QJsonObject toJson() const;

        static Example fromJson(const QJsonObject &json);
    };

    struct Word
    {
        int id;
        QString word;
        QString meaning;
        QList<Example> examples;
        QStringList mnemonics;
        bool isFavorite;

        Word(int id = 0,
             const QString &word = "",
             const QString &meaning = "",
             const QList<Example> &examples = {},
             const QStringList &mnemonics = {},
             bool isFavorite = false);

        QJsonObject toJson() const;

        static Word fromJson(const QJsonObject &json);
    };
}
